using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using Geekees.App.Cashbook.Lib;
using Geekees.App.Cashbook.Lib.Entity;
using Geekees.App.Cashbook.Lib.Exceptions;
using Geekees.App.Cashbook.Lib.Helper;

namespace Geekees.App.Cashbook.Web
{
	/// <summary>
	/// Summary description for PageBase.
	/// </summary>
	public class PageBase : System.Web.UI.Page
	{
		public PageBase()
		{
			
		}
		
		protected override void OnLoad(EventArgs e)
		{			
			base.OnLoad (e);		
		}
		
		protected override void OnInit(EventArgs e)
		{
			try
			{
				User o = LoginManager.GetCurrentUser();
			}
			catch( LoginException le )
			{
				string s = le.Message;
				Response.Redirect( string.Format( "Login.aspx?errorCode={0}&redirectUrl={1}", Consts.LOGIN_FAILED_REASON_SESSION_EXPIRED_ERROR, System.Web.HttpUtility.UrlEncode( Request.Url.ToString())) , true ); 
			}

			base.OnInit (e);
		}

	}
}
